# 用切片获取列表 [10, 20, 30, 40] 的前两个元素
nums = [10, 20, 30, 40]
nums = nums[0:2]
print(nums)
